package hu.jonas.allunit.source;

import static org.junit.Assert.assertNotNull;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IPackageFragment;
import org.junit.Test;

public class JavaUtilsTest {

	@Test
	public void shouldFindJavaMethodByNames() throws CoreException {
		IJavaProject javaProject = ProjectHelper.createProject("TestProject");
		IPackageFragment testPackage = ProjectHelper.createPackage(javaProject, "hu.test");
		
		ProjectHelper.createType(testPackage, "Test2.java", "class Test2 { @org.junit.Test public void s() {}}");
		
		IMethod method = JavaUtils.findJavaMethodByName("hu.test.Test2", "s");
		
		assertNotNull(method);
	}

}
